package com.shunhao.surface

import android.os.Bundle
import android.text.TextUtils
import android.widget.TextView
import com.shunhao.base.BaseFragment
import com.shunhao.model.EventCenter
import com.shunhao.rxlibrary.R

/**
 * 描述： 未找到Fragment
 *
 * @author Cuizhen
 * @date 2019/3/29
 */
class NotFoundFragment : BaseFragment() {

    override fun onEventComing(eventCenter: EventCenter<Any>) {}

    override fun getContentViewLayoutId(): Int = R.layout.fragment_not_found

    override fun isBindEventBusHere(): Boolean {
        return false
    }

    override fun onFirstUserVisible() {}

    override fun onUserVisible() {}

    override fun onUserInvisible() {}

    override fun initViews() {
        val tvMsg = mRootView.findViewById<TextView>(R.id.basic_core_tv_msg)
        val args = arguments
        args?.let {
            val msg = args.getString("msg")
            if (!TextUtils.isEmpty(msg)) {
                tvMsg.text = msg
            }
        }
    }

    override fun initData() {}

    companion object {

        @JvmStatic
        fun create(msg: String?): NotFoundFragment {
            val fragment = NotFoundFragment()
            val args = Bundle(1)
            args.putString("msg", msg)
            fragment.arguments = args
            return fragment
        }
    }
}